//
// Created by Semir on 2020/4/3.
//

#include <iostream>

using namespace std;

const int MAX_LEN = 1010;
int s;
int value[MAX_LEN];
int dp[MAX_LEN];

int main() {
    cin >> s;
    for (int i = 1; i <= s; i++) {
        for (int j = 1; j < i; j++) {
            if (i % j == 0) {
                value[i] += j;
            }
        }
    }
//    for (int i = 1; i <= s; i++) {
//        cout << value[i] << " ";
//    }
//    cout << endl;
    for (int i = 1; i <= s; i++) {
        for (int j = s; j >= i; j--) {
            dp[j] = max(dp[j], dp[j - i] + value[i]);
        }
        for (int j = 0; j <= s; j++) {
            cout << dp[j] << " ";
        }
        cout << endl;
    }
    cout << dp[s] << endl;
    return 0;
}
